GO


/****** Object:  StoredProcedure [dbo].[mov_getRentalsforCustomer]    Script Date: 06/12/2011 14:24:15 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[mov_getRentalsforCustomer]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[mov_getRentalsforCustomer]
GO



/****** Object:  StoredProcedure [dbo].[mov_getRentalsforCustomer]    Script Date: 06/12/2011 14:24:08 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO





-- =============================================
-- Modified:    Pritam Bhat
-- Create date: 6/04/2011
-- Description:	This procedure returns all the rental details
-- Modified Date: 
-- Modified   : 
-- Modified By: 

-- =============================================
CREATE PROCEDURE [dbo].[mov_getRentalsforCustomer] 	
(
	@email varchar(40)
)
AS
BEGIN
	
	SET NOCOUNT ON;


select r.rent_track_num as 'Rental Track', m.movie_name as 'Movie Name'
from customer c join cus_queue q 
on c.cus_id = q.cus_id join rental r
on r.que_id = q.que_id JOIN movie m
on q.movie_id =m.movie_id
where 
rent_receive_date is null AND
c.cus_email = @email

END




GO


